import * as subjectApi from '../../api/hmmm/subjects'
const subjectInfo = {
  namespaced: true,
  state: {
    subjectList: {},
    subjectDetail: {},
    simpleList: {}
  },
  mutations: {
    SET_SUBJECT_LIST: (state, newValue) => {
      state.subjectList = newValue
    },
    SET_SUBJECT_DETAIL: (state, newValue) => {
      state.subjectDetail = newValue
    },
    SET_SIMPLE_LIST: (state, newValue) => {
      state.simpleList = newValue
    },
  },
  actions: {
    async updateSubjectList (context, data) {
      const res = await subjectApi.getSubjectList(data)
      context.commit('SET_SUBJECT_LIST', res)
    },
    async updateSubjectDetail (context, data) {
      const res = await subjectApi.getSubjectDetail(data)
      context.commit('SET_SUBJECT_DETAIL', res)
    },
    async updateSimpleList(context, data) {
      const res = await subjectApi.simple(data)
      context.commit('SET_SIMPLE_LIST', res)
    },
  }
}

export default subjectInfo
